﻿using System;
using System.Collections.Generic;
using Xenta.Enums;

namespace Xenta.Entities
{
    /// <summary>
    /// Represents the translation entity.
    /// </summary>
    /// <typeparam name="THolder">The type of tranlsation holder entity.</typeparam>
    public abstract class TranslationEntity<THolder> : AuditableEntity
        where THolder : Entity
    {
        #region Properties

        /// <summary>
        /// Gets or sets the translation holder.
        /// </summary>
        public virtual THolder Holder
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the language.
        /// </summary>
        public virtual LanguageEntity Language
        {
            get;
            set;
        }

        #endregion

        #region Utilities

        protected override void Disclose(IDictionary<String, Object> obj,
            DisclosureLevel level,
            IDictionary<String, String> options)
        {
            base.Disclose(obj, level, options);
            if(level >= DisclosureLevel.Base)
            {
                obj["Holder"] = Holder.Disclose(DisclosureLevel.Primary, options);
                obj["Language"] = Language.Disclose(DisclosureLevel.Keys, options);
            }
        }

        #endregion
    }
}
